<?php
try{
	include '../ini.php';
    include '../classes/xl_product_categories.php';
    include '../classes/xl_brand_product.php';
    $dt_xl_product_category=new xl_product_category;
    $dt_xl_brand_product=new xl_brand_product;
    $list_category=$dt_xl_product_category->read_list();
    $list_brand=$dt_xl_brand_product->read_list();
    $dt_smarty->assign('list_brand',$list_brand);
    $dt_smarty->assign('list_category',$list_category);
	$contenForLayout=$dt_smarty->fetch('product/product_add.tpl');
	$dt_smarty->assign('contenForLayout',$contenForLayout);
	$dt_smarty->assign('titleForLayout','Thêm sản phẩm');
	$dt_smarty->display('layout/defaults.tpl');
    $dbh=NULL;
	
} catch(Exception $e){
	$_SESSION['msg']=$e->getMessage();
    $dbh=NULL;
}
function print_list($list,$id,$characters){
        foreach($list as $location):
            if($location['parent']==$id):
                    echo '<option value="'.$location['id'].'">'.$characters,$location['name'].'</option>';
                    print_list($list,$location['id'],$characters.$characters);
            endif;
        endforeach;
}
function print_list_brand($list,$characters){
        foreach($list as $location){
                    echo '<option value="'.$location['id'].'">'.$characters,$location['name'].'</option>';
                   
        }
}